package com.school.entity;

public class Teacher extends Person {
    private Course course;
    public Teacher(int id, String name) {
        super(id, name);
        this.course = null;
    }
    public void offerCourse(Course course) {
        this.course = course;
        course.setTeacher(this);
        System.out.println(getName() + "老师开设了" + course.getName() + "课程");
    }
    @Override
    public void printWorksheet() {
        super.printWorksheet();
        if (course != null) {
            System.out.println("--- 教师授课表 ---");
            System.out.println("授课课程：" + course.getName());
            System.out.println("上课地点：" + course.getLocation());
            System.out.println("上课时间：" + course.getTime());
        } else {
            System.out.println("--- 教师授课表 ---");
            System.out.println(getName() + "老师还没有开设课程");
        }
    }
    public Course getCourse() {
        return course;
    }

    public void setCourse(Course course) {
        this.course = course;
    }
}